<%@page contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<form:form modelAttribute="page" id="pagerForm" method="post"
           action="${ctx}/user/list?navtabid=userNav">
    <input type="hidden" name="pageNo" value="1" />
    <input type="hidden" id="pageSize" name="pageSize" value="${page.pageSize}" />
    <input type="hidden" name="orderBy" value="${page.orderBy}" />
    <input type="hidden" name="order" value="${page.order}" />
    <input type="hidden" name="username" value="${user.username}" />
</form:form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" action="${ctx}/user/list?navtabid=userNav"
          method="post">
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>用户名：<input type="text" name="username" value="${user.username}" />
                    </td>
                </tr>
            </table>
            <div class="subBar">
                <ul>
                    <li><div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">检索</button>
                        </div>
                    </div>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" target="dialog" href="${ctx}/user/add?navtabid=userNav" target="navTab"><span>添加</span></a></li>
            <li class="line">line</li>
        </ul>
    </div>
    <table class="table" width="100%" layoutH="138">
        <thead>
        <tr>
            <th width="40"><input type="checkbox" class="checkboxCtrl"
                                  group="c1" /></th>
            <th orderField="username"
                class=" ${page.orderBy eq 'username' ? page.order : '' }" >username</th>
            <th orderField="password"
                class=" ${page.orderBy eq 'password' ? page.order : '' }" >password</th>
            <th orderField="account_non_locked"
                class=" ${page.orderBy eq 'account_non_locked' ? page.order : '' }" >account_non_locked</th>
            <th orderField="email"
                class=" ${page.orderBy eq 'email' ? page.order : '' }" >email</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="item" items="${page.result}" varStatus="menu">
            <tr>
                <td><input type="checkbox" name="c1" value="" /></td>
                <td><c:out value='${item.username}'/></td>
                <td><c:out value='${item.password}'/></td>
                <td>${item.accountNonLocked == 'true' ? "正常" : "锁定" }</td>
                <td><c:out value='${item.email}'/></td>
                <td>

                    <shiro:hasPermission name="user:delete">
                        <a  class="btnDel" href="${ctx}/user/delete/${item.id}"
                            target="ajaxTodo" title="确定要删除${item.username}吗?"  >删除</a>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="user:edit">
                        <a  class="btnEdit" href="${ctx}/user/edit/${item.id}?navtabid=userNav"
                            target="dialog" title="修改${item.username}">修改</a>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="user:userrole">
                        <a   href="${ctx}/user/role/${item.id}?navtabid=userNav"
                             target="dialog" title="${item.username}用户对应角色">用户对应角色</a>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="user:locked">
                        <c:if test="${item.accountNonLocked=='true'}">
                            <a   href="${ctx}/user/locked/${item.id}?navtabid=userNav"
                                 target="ajaxTodo" title="确定锁定帐号${item.username}吗？">锁定</a>
                        </c:if>
                        <c:if test="${item.accountNonLocked=='false'}">
                            <a   href="${ctx}/user/notlocked/${item.id}?navtabid=userNav"
                                 target="ajaxTodo" title="确定解锁帐号${item.username}吗？">解锁</a>
                        </c:if>
                    </shiro:hasPermission>
                    <shiro:hasPermission name="user:changepassword">
                        <a   href="${ctx}/user/changepassword/${item.id}?navtabid=userNav"
                             target="ajaxTodo" title="确定重置密码">发送邮件</a>
                    </shiro:hasPermission>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <%@ include file="/commons/panelBar.jsp"%>
</div>